<template>
  <div class="game-goods-contanier" v-for="item in GoodsListData" @click="linkTo(item.id)">
    <div class="left-content">
      <van-image width="150" height="75" radius="4px" :src="item.imgUrl" />
    </div>
    <div class="right-content">
      <div class="game-name">{{ item.gameName }}</div>
      <div class="game-info">
        <div class="game-price">
          <div class="game-price-div">
            <span class="present-price">￥{{ item.presentPrice }}</span>
            <span class="original-price" v-if="item.presentPrice != item.originalPrice">￥{{ item.originalPrice }}</span>
          </div>
          <div class="historical-lowest" v-if="item.historicalLowest">史低</div>
        </div>
        <div class="game-score epic" v-if="item.gameScore >= 9">
          <van-icon name="award" />
          {{ item.gameScore }}
        </div>
        <div class="game-score excellent" v-else-if="item.gameScore >= 6 && item.gameScore < 9">
          <van-icon name="award" />
          {{ item.gameScore }}
        </div>
        <div class="game-score average" v-else>
          <van-icon name="award" />
          {{ item.gameScore }}
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive, defineProps } from 'vue';
import router from '../../route';

const props = defineProps({
  GoodsListData: Object
})

const linkTo = (gameId) => {
  console.log('111');
  router.push({
    path: '/gamedetail',
    query: {
      id: gameId
    }
  })
}

</script>

<style scoped>
.game-goods-contanier {
  padding: 10px 10px 0px 10px;
  display: flex;
  background-color: #fff;
}

.right-content {
  margin-left: 6px;
  padding-top: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-name {
  font-size: 14px;
}

.game-info {
  margin-top: 15px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-info .game-price {
  display: flex;
  align-items: center;
}

.game-price-div {
  padding: 2px 2px;
  border-radius: 2px;
  background-color: #f2f3f5;
}

.original-price {
  font-size: 10px;
  color: #969799;
  text-decoration: line-through;
}

.historical-lowest {
  padding: 2px 2px;
  color: #fff;
  background-color: #32b847;
}

.game-score {
  text-align: center;
  padding: 2px 4px 1px 4px;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.epic {
  background-image: linear-gradient(to right, #fe9c05, #f1772c);
}

.excellent {
  background-image: linear-gradient(to right, #4cb3fe, #1990fc);
}

.average {
  background-image: linear-gradient(to right, #8ad425, #5ecf1b);
}
</style>
